# Contributor: Zach DeCook <zachdecook@librem.one>
# Maintainer: Zach DeCook <zachdecook@librem.one>
pkgname=hyprcursor
pkgver=0.1.7
pkgrel=0
pkgdesc="The hyprland cursor format, library and utilities."
url="https://github.com/hyprwm/Hyprcursor"
arch="all"
license="BSD-3-Clause"
source="https://github.com/hyprwm/Hyprcursor/archive/v$pkgver/Hyprcursor-v$pkgver.tar.gz"
options="!check" # tests are broken
makedepends="
	cairo-dev
	cmake
	hyprlang
	librsvg-dev
	libzip-dev
	tomlplusplus-dev
	"
checkdepends="adwaita-icon-theme"
subpackages="$pkgname-dev $pkgname-doc $pkgname-util"

build() {
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=None
	cmake --build build
}

check() {
	cd build
	# Create a hyprcursor, so that the tests will work
	./hyprcursor-util -x /usr/share/icons/Adwaita/ -o ./
	# Put this in one of the paths it will search
	./hyprcursor-util -c ./extracted_Adwaita -o ~/.local/share/icons/
	# run the tests
	LD_LIBRARY_PATH=./ CTEST_OUTPUT_ON_FAILURE=TRUE ctest
	# 2/3 of the tests don't work.
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
	install -Dm644 -t "$pkgdir"/usr/share/doc/hyprcursor docs/*
	install -Dm644 hyprcursor-util/README.md "$pkgdir"/usr/share/doc/hyprcursor/README.md
}

util() {
	depends="xcur2png"
	amove usr/bin/hyprcursor-util
}


sha512sums="
dd506860fc7a0d5b1f9602330becc7f9a37fda19d92fcc10150e6e23680124d63451b98a92e33b9a820db385fdba29a7f306d0c1639426aa06c749fa1dfad04e  Hyprcursor-v0.1.7.tar.gz
"
